package com.zch.rpc.service.config;

import com.zch.rpc.core.provider.SpringRpcProviderFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: zch
 * @Date: 2019/1/5 19:51
 * @Description:
 */
@Configuration
public class RpcProviderConfig {
    @Value("${rpc.protocol.port}")
    private int port;
    @Value("${rpc.protocol}")
    private String protocol;

    @Bean
    public SpringRpcProviderFactory getProviderFactory(){
        SpringRpcProviderFactory springRpcProviderFactory=new SpringRpcProviderFactory();
        springRpcProviderFactory.setPort(port);
        springRpcProviderFactory.setProtocol(protocol);
        return springRpcProviderFactory;
    }
}
